using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Framework.Module.UpDownLoad.Library;
using Framework.Library;
using Framework.Library.Utilities;

namespace Framework.Module.UpDownLoad.Web
{
    public partial class Categories_List : System.Web.UI.UserControl
    {
        //string nodePath = string.Empty;
        //protected void Page_Load(object sender, EventArgs e)
        //{
                      
        //}

        //protected override void OnPreRender(EventArgs e)
        //{
        //    DataTable dtCommands = Categories_Controller.GetAll();
        //    LoadForNavbar(dtCommands);
        //}
        //private void LoadForNavbar(DataTable dtCommands)
        //{
        //    nodePath = "|";            
        //    DataListItem focus1 = DataList1.SelectedItem;
        //    if (focus != null)
        //    {
        //        while (true)
        //        {
        //            if (focus1.Parent == null) break;
        //            else
        //            {
        //                focus1 = focus1.Parent;
        //                nodePath += focus1.ID + "|";
        //            }
        //        }
        //    }
        //    DataList1.Items.Clear();

        //    DataRow[] drRoots = dtCommands.Select("ParentID = 0");
        //    foreach (DataRow row in drRoots)
        //    {
        //        DataListItem rootItem = new DataListItem();
        //        if (AppEnv.GetLanguage() != "vi-VN")
        //        {
        //            rootItem.Text = row["NameENG"].ToString();
        //        }
        //        else rootItem.Text = row["NameVIE"].ToString();
        //        rootItem.Value = row["ID"].ToString();
        //        rootItem.ID = row["ID"].ToString();
        //        DataList Items = (DataList)e.Item.FindControl("lbllayout");
        //        NavBar1.Items.Add(rootItem);
        //        LoadForCurCommand(rootItem, dtCommands);
        //    }
        //}
        //private void LoadForCurCommand(DataListItem curNode, DataTable source)
        //{
        //    int curCatId = ConvertUtility.ToInt32(curNode.ID);
        //    DataRow[] drChildCommands = source.Select("ParentID = " + curCatId);

        //    foreach (DataRow row in drChildCommands)
        //    {
        //        DataListItem childNode = new DataListItem();
        //        if (AppEnv.GetLanguage() != "vi-VN")
        //        {
        //            childNode.Text = row["NameENG"].ToString();
        //        }
        //        else childNode.Text = row["NameVIE"].ToString();
        //        childNode.Value = row["ID"].ToString();
        //        childNode.ID = row["ID"].ToString();
        //        if (nodePath.IndexOf("|" + childNode.ID + "|") >= 0) childNode.Expanded = true;
        //        curNode.Items.Add(childNode);
        //        LoadForCurCommand(childNode, source);
        //    }
        //}

        //protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        //{
        //    DataTable dtCommands = Categories_Controller.GetAll();
        //    DataRow[] drRoots = dtCommands.Select("ParentID = 0");
        //    foreach (DataRow row in drRoots)
        //    {
        //        DataListItem rootItem = new DataListItem();
        //        if (AppEnv.GetLanguage() != "vi-VN")
        //        {
        //            rootItem.Text = row["NameENG"].ToString();
        //        }
        //        else rootItem.Text = row["NameVIE"].ToString();
        //        rootItem.Value = row["ID"].ToString();
        //        rootItem.ID = row["ID"].ToString();
        //        DataList Items = (DataList)e.Item.FindControl("lbllayout");
        //        NavBar1.Items.Add(rootItem);
        //        LoadForCurCommand(rootItem, dtCommands);
        //    }
        //}
    }
}